/**
 * 业务逻辑
 */
const db = require("../database/db-mysql")
const userDao = require("../dao/userDao");

module.exports = {
    getUserData: async (ctx, username, password) => {
        // let userData = await userDao.getUserByName(ctx, username, password)
        let userData = await userDao.findByName(username);
        console.log("service:",userData)
        return userData;
    },
    getMenu: async (role) => {
        console.log("role", role)
        let menuList = await db.query("select * from role_menu where role_id = ?", [role]);
        return menuList;
    },
    register: async (ctx, { username, password }) => {
        let options = { username, password }
        let user = await userDao.create(options)
        return user;
    }
}